<%--
  User: Shengzhao Li
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<!DOCTYPE html>
<html>
<head>
    <title>结算明细 - Cooking Account</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/cooking-main.css"/>
</head>
<body>
<div class="page">
    <div id="header_menu">
        <a class="offline-button" href="../../overview" id="record">首页</a>
        <a class="offline-button" href="../real_time" id="settlement">实时信息</a>
    </div>
    <div id="grid_container">
        <table cellpadding="0" cellspacing="0" class="default-table">
            <tr class="form_tr_background">
                <td style="width: 15%;">结算日期:</td>
                <td colspan="4">${cookingSettlementDto.createTime}</td>
            </tr>
            <tr>
                <td>结算总金额:</td>
                <td colspan="4"><strong>${cookingSettlementDto.totalAmount}</strong></td>
            </tr>
            <tr class="form_tr_background">
                <td>人均金额:</td>
                <td colspan="4"><strong>${cookingSettlementDto.averageAmount}</strong></td>
            </tr>
            <tr>
                <td colspan="5">&nbsp;</td>
            </tr>
            <tr>
                <th class="default-table-header">记录人</th>
                <th colspan="2" class="default-table-header">实际支出金额</th>
                <th colspan="2" class="default-table-header">应付金额(-表示需要支付)</th>
            </tr>
            <c:forEach items="${cookingSettlementDto.userSettlementDtoList}" var="us" varStatus="i">
                <tr class="${i.count%2 ==0?'form_tr_background':''}">
                    <td>${us.userNickName}</td>
                    <td colspan="2">${us.amount}</td>
                    <td colspan="2"><strong>${us.payableAmount}</strong></td>
                </tr>
            </c:forEach>
            <c:if test="${empty cookingSettlementDto.userSettlementDtoList}">
                <tr>
                    <td colspan="3">没有任何结算明细.</td>
                </tr>
            </c:if>
            <tr>
                <td colspan="5">&nbsp;</td>
            </tr>
            <tr>
                <td colspan="5">结算明细, 共<strong>${cookingSettlementDto.accountSize}</strong>条记录.</td>
            </tr>
            <tr>
                <th class="default-table-header">日期</th>
                <th class="default-table-header">金额</th>
                <th class="default-table-header">记录人</th>
                <th class="default-table-header">状态</th>
                <th class="default-table-header">描述</th>
            </tr>
            <c:forEach items="${cookingSettlementDto.accountDtoList}" var="account" varStatus="i">
                <tr class="${i.count%2 ==0?'form_tr_background':''}">
                    <td>${account.date}</td>
                    <td>${account.amount}</td>
                    <td>${account.creatorName}</td>
                    <td>${account.status}</td>
                    <td>${account.description}</td>
                </tr>
            </c:forEach>
        </table>
    </div>
    <div>
        <a href="${back?'javascript:history.back();':'../form'}">返回</a>
    </div>
</div>
</body>
</html>